package team.seekers.hula.common.entity.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

/**
 * 消息通知
 */


@Getter
public enum MessageTypeEnum implements IEnum<Integer> {

    COMMEN(0,  "普通消息"),
    TOPIC(1,  "引用帖子"),
    POINT(2,"观点"),
    ANSWER(3,"回答"),
    SPECIAL_QUESTION_WAIT(4, "专业提问新增待审核问题"),
    QUESTION_POINT_WAIT(5,"问题观点待审核"),
    ANSWER_COMMENT(6,  "回答新增评论");

    private int type;

    private String name;

    MessageTypeEnum(int type, String name) {
        this.type = type;
        this.name = name;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

    public static MessageTypeEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static MessageTypeEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
    }
}
